<template>
  <div class="page-movie" style="background-color:#662929">
    <div class="movie-info" style="background-color:#662929">
      <!--标头  -->
      <div class="crumbs-nav">
        <router-link :to='`/movie/${id}?${name}`' class="smallbutton">
          猫眼电影 >
        </router-link> &nbsp;<span>{{moviedetailst.name}}</span>
      </div>
      <!-- 头部简介 -->
      <div class="list-wrap">
        <div class="item">
          <div class="main-block">
            <div class="avatar">
              <div class="default-img-bg">
                <img :src="moviedetailst.movieImg" style="height:138px; width:100px;" />
              </div>
            </div>
            <div class="mb-outline-b">
              <div class="movie_title">
                <div class="title">{{moviedetailst.name}}</div>
              </div>
              <div class="column">
                <ul class="movies_lists">
                  <li>{{moviedetailst.englishName}}</li>
                  <li>{{movieDetailType[0]}} / {{movieDetailType[1]}} / {{movieDetailType[2]}}
                    {{moviedetailst.watchType}}</li>
                  <li>{{movieDetailActors[0]}} / {{movieDetailActors[1]}} / {{movieDetailActors[2]}}</li>
                  <li>{{moviedetailst.time}} / {{moviedetailst.duration}}</li>
                </ul>
              </div>

            </div>
          </div>
        </div>

      </div>
      <!-- 评分 -->
      <div class="real-time-word-of-mouth">
        <div class="top">
          <div class="left">猫眼购票评分</div>
          <div class="right">195,456 人想看 &nbsp; 174,566,654 人看过</div>
        </div>
        <!-- 点评 评分 -->
        <div class="middle">
          <div class="left-section">
            <span>{{movieDetailEvaluate.pingfen}}</span>
          </div>
          <div class="right-reputation">
            <span>2021年10月</span>
            <span>中国大陆票房榜</span>
          </div>
          <div class="people-grade">248,048人评</div>
          <div class="stable">年度黑马佳作,票房口碑领跑</div>
        </div>
        <!-- 简介 -->
        <div class="brief-introduction">
          <div class="title">
            <span>简介</span>
            <div>
              <button>
                <span @click="show">展开</span>
              </button>
            </div>
          </div>
          <!-- 内容 -->
          <div class="content ">
            <p>{{moviedetailst.intro}}</p>
          </div>
        </div>
        <!-- 演员列表 -->
        <div class="actors">
          <div class="box">
            <div>
              <img src="	https://p1.meituan.net/movie/46e8ca7ebc9b874b0eea985d0cc2d721149020.jpg@160w_224h_80q_1e_1c" />
              <span class="b">子墨</span>
              <span class="bottom">导演</span>
            </div>
            <div>
              <img src="	https://p1.meituan.net/movie/46e8ca7ebc9b874b0eea985d0cc2d721149020.jpg@160w_224h_80q_1e_1c" />
              <span class="b">子墨</span>
              <span class="bottom">导演</span>
            </div>
          </div>
        </div>
        <!-- 剧照 -->
        <div class="photoList">
          <van-swipe :loop="false" :width="150" class="my-swipe">
            <van-swipe-item>
              <img src="https://p1.meituan.net/movie/b91992b37baced112347e156a0a1fc4a673310.jpg@420w_279h_80q_1e_1c"
                alt="" style="width:140px; height:90px">
            </van-swipe-item>
            <van-swipe-item>
              <img src="https://p1.meituan.net/movie/e305377ff51a191003bf30f655d50601503738.jpg@420w_279h_80q_1e_1c"
                alt="" style="width:140px; height:90px">
            </van-swipe-item>>
            <van-swipe-item>
              <img src="https://p1.meituan.net/movie/7b4353304fde9c99a1a53d8e17a7e14d460460.jpg@420w_279h_80q_1e_1c"
                alt="" style="width:140px; height:90px">
            </van-swipe-item>
            <van-swipe-item>
              <img src="https://p0.meituan.net/movie/e4fc6c068e68afa1418adf3ed87d3762443051.jpg@420w_279h_80q_1e_1c"
                alt="" style="width:140px; height:90px">
            </van-swipe-item>
          </van-swipe>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    mapGetters,
    mapState
  } from "vuex";
  export default {
    name: "MovieList",
    data() {
      return {
        id: "",
        name: "",
      };
    },
    computed: {
      ...mapState({ moviedetailst: (state) => state.moviedetails.detailst || {}}),
      ...mapGetters(['movieDetailType', 'movieDetailActors', 'movieDetailEvaluate'])
  },
  mounted() {
    this.id = this.$route.params.id;
    this.name = this.$route.query.name;
    // console.log(this.id);
    this.$store.dispatch('details',this.id);
  },
  beforeRouteEnter (to, from, next) {
    // 在渲染该组件的对应路由被 confirm 前调用
    // 不！能！获取组件实例 `this`
    // 因为当守卫执行前，组件实例还没被创建
    if (from.path.indexOf('/movie')==-1)  next('/home')
    else next()
    next()
    // console.log(from)
    // console.log(from.path);
  },
  methods: {
    show() {

    }
  }
};


</script>

<style lang="less" scoped>
  .movie-info {
    width: 343px;
    height: 936px;
    margin: 0 auto;
    // border: 1px solid black;
    position: relative;

    .crumbs-nav {
      width: 100%;
      height: 41px;
      position: relative;
      top: 16px;

      // border: 1px solid black;
      .smallbutton {
        color: #ccc;

        .name {
          span {
            color: #ccc;
          }
        }
      }
    }

    .list-wrap {
      width: 343px;
      margin-left: 15px;
      position: relative;
      margin-top: 15px;

      .item {
        position: absolute;
        left: -13px;
      }

      .main-block {
        position: relative;
        width: 330px;
        margin-bottom: 5px;
      }

      .mb-outline-b {
        position: absolute;
        left: 110px;
        width: 245px;
        top: 0;
        right: -10px;

        .movie_title {
          .title {
            position: relative;
            left: 13px;
            font-weight: bold;
            color: #fff;
            font-size: 20px;
          }
        }

        .movies_lists {
          position: absolute;
          left: -34px;
          width: 240px;
        }

        li {
          width: 213px;
          height: 20px;
          /*溢出部分文字隐藏*/
          overflow: hidden;
          /*溢出部分省略号处理*/
          text-overflow: ellipsis;
          margin-top: 9px;
          margin-left: 49px;
          font-size: 11px;
          color: #fff;
        }

        .btn {
          position: absolute;
          width: 54px;
          height: 28px;
          // border: 1px solid black;
          border-radius: 10px;
          background-color: red;
          text-align: center;
          line-height: 28px;
          font-size: 13px;
          color: white;
          top: 45px;
          right: 5px;
        }
      }
    }

    .real-time-word-of-mouth {
      position: relative;
      width: 343px;
      height: 133px;
      top: 153px;
      //   border: 1px solid black;
      background: rgba(0, 0, 0, 0.18);
      border-radius: 16px;

      .top {
        position: relative;
        width: 333px;
        left: 5px;
        height: 28px;

        //   border: 1px solid black;
        .left {
          position: relative;
          top: 4px;
          font-size: 13px;
          color: #fff;
        }

        .right {
          position: relative;
          top: -14px;
          left: 100px;
          font-size: 13px;
          color: #ccc;
        }
      }

      .middle {
        position: relative;
        left: 5px;
        width: 332px;
        height: 58px;

        //   border: 1px solid black;
        .left-section {
          font-weight: bold;
          width: 208px;
          height: 40px;

          //   border: 1px solid black;
          span {
            font-size: 38px;
            color: #ffb400;
            position: relative;
            left: 30px;
          }
        }

        .right-reputation {
          width: 120px;
          height: 40px;
          border: 1px solid #b49c70;
          border-radius: 10px;
          position: absolute;
          top: 5px;
          right: 0;
          padding-left: 3px;

          span {
            font-size: 13px;
            color: #ccc;
          }
        }

        .people-grade {
          width: 137px;
          height: 14px;
          //   border: 1px solid black;
          font-size: 13px;
          color: #ccc;
        }

        .stable {
          width: 100%;
          height: 28px;
          border-radius: 10px;
          color: #fff;
          font-size: 13px;
          line-height: 28px;
          //   border: 1px solid black;
          background: rgba(0, 0, 0, 0.18);
          margin-top: 10px;
        }
      }
    }

    .brief-introduction {
      position: relative;
      top: 70px;
      width: 343px;
      // height: 209px;
      overflow: hidden;

      // border: 1px solid black;
      .title {
        width: 100%;
        height: 24px;

        //   border: 1px solid black;
        span {
          color: #fff;
        }

        div {
          position: absolute;
          top: 0px;
          right: 0;
          color: #fff;

          button {
            background: #662929;
          }
        }
      }

      .content {
        p {
          font-size: 14px;
          line-height: 30px;
          color: #fff;
        }
      }
    }

    .actors {
      position: relative;
      width: 100%;
      // height: 143px;
      // border: 1px solid black;
      top: 70px;
      overflow: hidden;

      .box {
        width: 350px;
        height: 200px;
        margin: 10px auto;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap; //注意设置不可换行
        position: relative;

        div {
          width: 110px;
          height: 180px;
          line-height: 200px;
          text-align: center;
          margin-right: 10px;
          // background-color: pink;
          position: relative;
          display: inline-block; //把子元素设置成行内块元素

          .b {
            line-height: 26px;
            position: absolute;
            left: 0;
            bottom: 30px;
            color: black;
            font-size: 14px;
          }

          .bottom {
            width: 109px;
            line-height: 26px;
            position: absolute;
            left: 0;
            text-align: left;
            overflow: hidden;
            text-overflow: ellipsis;
            bottom: 7px;
            font-weight: bold;
          }

          img {
            width: 100%;
            height: 145px;
          }
        }
      }
    }

    .photoList {
      width: 100%;
      height: 98px;
      // border: 1px solid black;
      margin-top: 50px;
      overflow: hidden;

      .my-swipe .van-swipe-item {
        color: #fff;
        font-size: 20px;
        position: relative;
        line-height: 95px;
        text-align: center;
        left: -10px;
        // margin-left: -77px;
        // background-color: #39a9ed;
      }
    }
  }
</style>